#include "bsp_delay.h"
#include "bsp_sys.h"
#include "bsp_usart.h"

int main(void)
{
    u16 times = 0;
    u8 tmpRecBuf[100] = {0};
    __disable_irq();
    delay_init();            //延时函数初始化
    USART_Config();
    __enable_irq();
    printf("USART Project\r\n");

    while(1)
    {
        if(USART1_GetRxFFValidSize() > 0)
        {
            u16 len = USART1_GetRxTotleDataLen();

            if(SUCCESS == USART1_RecBuf(tmpRecBuf, len))
            {
                USART_SendBuf(USART1, tmpRecBuf, len);
            }
        }
        else
        {
            times++;

            if(times % 5000 == 0)
            {
                printf("\r\nGoing one week\r\n");
            }

            if(times % 200 == 0)
                printf("today successful\n");

            delay_ms(10);
        }
    }
}

